<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>平行四边形</title>
    <link rel="stylesheet" href="../public.css">
    <style>
        .box{
            width: 300px;
            height: 100px;
            margin: 20px auto;
            line-height: 100px;
            text-align: center;
        }
        .parallel{
            background-color: green;
            transform: skewX(-45deg);
        }
        .parallel div{
            transform: skewX(45deg);
            
        }
        .parallel1{
            position: relative;
        }
        .parallel1::after{
            display: block;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            content: '';
            z-index: -1;
            background-color: green;
            transform: skewX(-45deg);
        }
    </style>
</head>
<body>
    <div class="content">
        <h1>嵌套元素方案</h1>
        <ul>
            <li>通过两个元素，一个元素设置背景并倾斜，在对内容元素应用一次方向skew()变形</li>
            <li>注意需要是块元素</li>
        </ul>
        <div class="box parallel">
            <div>
                click me
            </div>
        </div>
    </div>
    <div class="content">
        <h1>伪元素方案</h1>
        <ul>
            
        </ul>
        <div class="box parallel1">
                click me
        </div>
    </div>
</body>
</html>